package com.zz.jdk8;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * @author zhr
 */
public class Tj1 {
    public static void main(String[] args) {
        List<String> l1 = new ArrayList<String>();
        l1.add("cc");
        l1.add("aaa");
        l1.add("dd");
        l1.add("bb");
        List<String> l2 = new ArrayList<String>();
        l2.add("cc");
        l2.add("aaa");
        l2.add("dd");
        l2.add("bb");
        System.out.println(l1);
        Collections.sort(l1, new Comparator<String>() {
            @Override
            public int compare(String s1, String s2) {
                return s1.compareTo(s2);
            }
        });
        System.out.println(l1);
        System.out.println(l2);
        Collections.sort(l2, (s1, s2) -> {
            return s1.compareTo(s2);
        });
        System.out.println(l2);


    }
}
